x11: Don't crash if a window is on an unmanaged screen
authorBenjamin Otte <otte@redhat.com>
Mon, 25 Nov 2013 20:11:56 +0000 (21:11 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 25 Nov 2013 20:14:34 +0000 (21:14 +0100)
_gdk_x11_display_screen_for_xrootwin() can return NULL. If so, return
NULL from gdk_x11_window_foreign_new_for_display().

https://bugzilla.gnome.org/show_bug.cgi?id=709716

gdk/x11/gdkwindow-x11.c

index 6ee7a9602f827a48bd56f6d8fbf86ae44c8aecd3..a8e92b6bec8ad55e6ca3a7ea363577073bb76021 100644 (file)
@@ -1229,6 +1229,8 @@ gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
     XFree (children);
 
   screen = _gdk_x11_display_screen_for_xrootwin (display, root);
+  if (screen == NULL)
+    return NULL;
 
   win = _gdk_display_create_window (display);
   win->impl = g_object_new (GDK_TYPE_WINDOW_IMPL_X11, NULL);